<?php 
if($adc->getSetting('model-manager') && is_object($adc->getCurrentAdBrand()) > 0)
{ require($adc->getViewPath().'filters/AdModelsGrid.php'); }
$total = count($adc->getAdBrands());
if($total > 1)
{
	$collapsed = '';
	if($adc->getSetting('CollapseBrand') == 0) 
	{ $collapsed = 'in'; }
	else
	{ $collapsed = ''; }
	if(is_object($adc->getCurrentAdBrand())) 
	{ $collapsed = ''; }
	?>
    <div class="accordion-group placement-filter">
        <div class="accordion-heading">
            <a class="accordion-toggle" data-toggle="collapse" data-parent="#filtergrid" href="#brandfiltergrid">
                <?php 
                if(is_object($adc->getCurrentAdBrand()))
                { echo ucfirst($txt->getWord('choosen')).' '.$txt->getWord('brand').': '.$adc->getCurrentAdBrand()->getTitle(); }
                else
                { echo ucfirst($txt->getWord('choose').' '.$txt->getWord('brand')); }
                ?>
            </a>
        </div>
        <div id="brandfiltergrid" class="accordion-body collapse <?php echo $collapsed; ?>">
            <div class="accordion-inner">
                <div class="row-fluid">
                    <ul class="thumbnails">
                    <?php
                    $i = 1;
                    $class == 'alpha';
                    foreach($adc->getAdBrands() as $brand)
                    {
                        if(($adc->getCurrentAdCatId() == 0) && ($brand->getBrandOrder() < 10) && (($brand->getAdsCount() > 0) || ($adc->getSetting('ViewEmptyBrand') > 0)))
                        {
                            $link = $katana->getURL();
                            if($adc->getCurrentAdCatId() > 0)
                            { $link .= '/adcat/'.$adc->getCurrentAdCatId().'/'; }
                            else
                            { 
                                if($brand->getCatId() > 0)
                                { $link .= '/adcat/'.$brand->getCatId().'/'; }
                                else
                                {
                                    if($adc->getCurrentAdTypeId() > 0)
                                    { $link .= '/adtype/'.$adc->getCurrentAdTypeId().'/'; }
                                    else
                                    { 
                                        if($brand->getTypeId() > 0)
                                        { $link .= '/adtype/'.$brand->getTypeId().'/'; }
                                        else
                                        { $link .= '/adtype/1/'; }
                                    }
                                }
                            }
                            $link .= 'adbrand/'.$brand->getId().'/';
                            if(intval($_GET['bt']) > 0)
                            { $link .= '?bt='.intval($_GET['bt']); }
                            
                            echo '<li class="span2 col-md-2 center '.$class.'">';
                                echo '<a class="prospect-brand thumbnail" href="'.$link.'" title="'.$brand->getTitle().'">';
                                if($adc->getSetting('BrandImages'))
                                {
                                    if(is_object($brand->getImageObject()))
                                    { 
                                        
                                        echo '<img alt="'.$brand->getTitle().'" src="'.$brand->getImageObject()->getLink($adc->getSetting('BrandListW'), $adc->getSetting('BrandListH')).'" alt="'.$brand->getTitle().'" />'; 
                                    }
                                }
                                echo '<span itemprop="brand">'.$txt->truncate($brand->getTitle(), 25, '', '').'</span> ('.$brand->getAdsCount().')</a>';
                            echo '</li>';
                            
                            if(($i%6) == 0)
                            { echo '</ul></div><div class="row-fluid"><ul class="thumbnails">'; }
                        
                            $i++;
                        }
                    }
                    ?>
                    <div class="v-space"></div><hr />
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <?php
}
?>